package datatypes.r2.basic.impl;

import datatypes.r2.basic.UUID;
import datatypes.r2.quantities.INT;
import datatypes.r2.quantities.impl.IntegerNumber;

/**
 * A globally unique string representing a DCE Universal Unique Identifier
 * (UUID) in the common UUID format that consists of 5 hyphen-separated groups
 * of hexadecimal digits having 8, 4, 4, 4, and 12 places respectively.
 * 
 * Both the UUID and its string representation are defined by the Open Group,
 * CDE 1.1 Remote Procedure Call specification, Appendix A.
 * 
 * UUIDs are assigned based on Ethernet MAC addresses, the point in time of
 * creation and some random component. This mix is believed to generate
 * sufficiently unique identifiers without any organizational policy for
 * identifier assignment (in fact this piggy-backs on the organization of MAC
 * address assignment). Note that there are other common methods for generating
 * UUIDs. HL7 does not require that the UUID method defined by the Open Group
 * specification so long as generated UUIDs are globally unique.
 * 
 * UUIDs are not the preferred identifier scheme for use as HL7 UIDs. UUIDs may
 * be used when identifiers are issued to objects representing individuals
 * (e.g., entity instance identifiers, act event identifiers, etc.). For objects
 * describing classes of things or events (e.g., catalog items), OIDs are the
 * preferred identifier scheme.
 * 
 * @author Obama
 * 
 */
public class UniversalUniqueIdentifier extends UniqueIdentifierString implements
		UUID {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private IntegerNumber timeLow;
	private IntegerNumber timeMid;
	private IntegerNumber timeHighAndVersion;
	private IntegerNumber clockSequence;
	private IntegerNumber node;

	private java.util.UUID uuid;

	/**
	 * The low field of the timestamp.
	 */
	@Override
	public INT timeLow() {

		return timeLow;
	}

	/**
	 * The middle field of the timestamp.
	 */
	@Override
	public INT timeMid() {

		return timeMid;
	}

	/**
	 * The high field of the timestamp multiplexed with the version number.
	 */
	@Override
	public INT timeHighAndVersion() {

		return timeHighAndVersion;
	}

	/**
	 * The high field of the clock sequence multiplexed with the variant and the
	 * low field of the clock sequence.
	 */
	@Override
	public INT clockSequence() {

		return clockSequence;
	}

	/**
	 * The spatially unique node identifier (usually the host address).
	 */
	@Override
	public INT node() {

		return node;
	}

	public java.util.UUID getUuid() {
		return uuid;
	}

	public void setUuid(java.util.UUID uuid) {
		this.uuid = uuid;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

}
